import { BasicColumn } from '@/components/Table';
import { h } from 'vue';
import { CaretDownFilled } from '@ant-design/icons-vue';


// 自定义过滤图标的方法
// 定义 filterIcon 方法
const filterIcon = ({ filtered, column }: { filtered: boolean; column: any; }) => {
  return h(CaretDownFilled, {
    style: {
      color: filtered ? '#ABBACD' : undefined,
    },
    onClick: () => {
      // 这里的 onFilter 需要外部传入或通过其他方式获取
      if (column && column.onFilter) {
        column.onFilter(null, column);
      }
    },
  }) as any;
};
//table
interface otherColumns {
  timeParams?: string[]
  condition?: string[]
  otherFormType?: string
  field?: string,
  options?: any,
  history?: boolean
}
export const allColumn: (BasicColumn & otherColumns)[] = [
  {
    title: '姓名',
    dataIndex: 'name',
    key: 'name',
    formType: 'input',
    fixed: 'left',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '操作',
    dataIndex: 'action',
    fixed: 'left',
    key: 'action',
    condition: ['待分配', '待约面', '待面试', '实习中', '待入职', '试用中',"待签三方"],
    width: 110
  },


  {
    title: '状态',
    dataIndex: 'statusName',
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"],
    key: 'applicationStages',
    otherFormType: 'search',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
  },
  {
    title: '学历',
    dataIndex: 'qualificationType',
    key: 'qualificationType',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    width: 90,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '学校',
    dataIndex: 'schoolName',
    key: 'schoolName',
    formType: 'input',
    customFilterDropdown: true,
    history: true,
    filterIcon,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '学院',
    dataIndex: 'schoolDepartment',
    key: 'schoolDepartment',
    formType: 'input',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '毕业时间',
    dataIndex: 'educationType',
    key: 'educationType',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '性别',
    dataIndex: 'sex',
    key: 'sex',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    width: 70,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '手机号',
    dataIndex: 'phone',
    key: 'phone',
    customFilterDropdown: true,
    formType: 'input',
    filterIcon,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '录取分校',
    dataIndex: 'entryLocation',
    key: 'entryLocation',
    formType: 'select',
    otherFormType: 'search',
    customFilterDropdown: false,
    condition: ['待入职', '解约','待签应约',"待签三方"],
    filterIcon,
  },
  {
    title: '录取科目',
    dataIndex: 'entrySubject',
    key: 'entrySubject',
    formType: 'select',
    otherFormType: 'search',
    customFilterDropdown: true,
    condition: ['待入职', '解约','待签应约',"待签三方"],
    filterIcon,
  },
  {
    title: '录取年级',
    dataIndex: 'entryGrade',
    key: 'entryGrade',
    formType: 'select',
    otherFormType: 'search',
    customFilterDropdown: true,
    condition: ['待入职', '解约','待签应约',"待签三方"],
    filterIcon,
  },
  {
    title: '预计到岗时间',
    dataIndex: 'limitTime',
    key: 'entryTime',
    formType: 'time',
    field: 'es.on_duty_time',
    timeParams: ['limitBeginTime', 'limitEndTime'],
    customFilterDropdown: true,
    condition: ['待入职','待签应约',"待签三方"],
    filterIcon
  },
  {
    title: '过期时间',
    dataIndex: 'expirationTime',
    key: 'expirationTime',
    formType: 'time',
    field: 'es.agency_limit_time',
    timeParams: ['expireBeginTime', 'expireEndTime'],
    customFilterDropdown: true,
    condition: ['待入职','待签应约'],
    filterIcon
  },
  {
    title: '入职分校',
    dataIndex: 'entryLocation',
    key: 'entryLocation',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['我的团队', '实习中', '试用中', '已转正', '离职', '劝退']
  },
  {
    title: '入职科目',
    dataIndex: 'entrySubject',
    key: 'entrySubject',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['我的团队', '实习中', '试用中', '已转正', '离职', '劝退']
  },
  {
    title: '入职年级',
    dataIndex: 'entryGrade',
    key: 'entryGrade',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['我的团队', '实习中', '试用中', '已转正', '离职', '劝退']
  },
  {
    title: '导师',
    otherFormType: 'search',
    dataIndex: 'entryTeacher',
    key: 'entryTeacher',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['实习中', '试用中', '离职', '劝退']
  },
  {
    title: '考核时间',
    dataIndex: 'examineTime',
    key: 'examineTime',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待考核', '考核历史'],
    formType: 'time',
    timeParams: ['examBeginTime', 'examEndTime'],
    field: 'num.examine_start_time',
  },
  {
    title: '考核官',
    dataIndex: 'examineUser',
    key: 'examers',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待考核', '考核历史']
  },
  {
    title: '培训期数',
    dataIndex: 'trainingNumber',
    key: 'trainingNumber',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待考核', '考核历史'],
    formType: 'select',
    otherFormType: 'sort',
    align: "center",
    field: 'num.training_number',
  },
  {
    title: '培训官',
    dataIndex: 'trainingUser',
    key: 'trainers',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待考核', '考核历史']
  },
  {
    title: '维护HR',  //维护hr  
    dataIndex: 'preserveUserName',
    key: 'preserveUserId',
    formType: 'select',
    customFilterDropdown: true,
    otherFormType: 'search',
    filterIcon,
    condition: ['待考核', '我的团队', '考核历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退',"放弃",'待签应约',"待签三方"]
  },
  {
    title: '面试官',  //  面试官 //没做筛选
    dataIndex: 'interviewer',
    key: 'interviewOfficer',
    formType: 'select',
    customFilterDropdown: true,
    otherFormType: 'search',
    filterIcon,
    condition: ['约面历史', '面试历史']
  },

  {
    title: '面试时间',
    dataIndex: 'interviewTime',
    key: 'interviewTime',
    formType: 'time',
    field: 'es.interview_time',
    timeParams: ['faceBeginTime', 'faceEndTime'],
    customFilterDropdown: true,
    filterIcon,
    condition: ['待面试', '约面历史', '面试历史'],
    width: 200
  },
  {
    title: '约面HR',
    dataIndex: 'interviewUserName',
    key: 'interviewUserId',
    formType: 'select',
    otherFormType: 'search',
    customFilterDropdown: true,
    filterIcon,
    width: 100,
    condition: ['待面试', '面试历史']
  },
  {
    title: '面试类型',
    dataIndex: 'interviewType',
    key: 'interviewType',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待面试', '约面历史', '面试历史']
  },

  {
    title: '操作人',
    dataIndex: 'operator',
    key: 'operators',
    formType: 'select',
    otherFormType: 'sort',
    field: 'pr.operator',
    customFilterDropdown: true,
    filterIcon,
    condition: ['筛选历史', '解约', '离职', '劝退',"放弃"]
  },
  {
    title: '操作时间',
    dataIndex: 'operatorTime',
    key: 'operatorTime',
    formType: 'time',
    field: 'pr.operator_time',
    timeParams: ['operatorBeginTime', 'operatorEndTime'],
    customFilterDropdown: true,
    filterIcon,
    condition: ['筛选历史', '解约', '离职', '劝退',"放弃" ]
  },
  {
    title: '操作人',
    dataIndex: 'labelUpdateOperator',
    key: 'labelUpdateOperator',
    formType: 'select',
    otherFormType: 'sort',
    field: 'pr.labelUpdateOperator',
    customFilterDropdown: true,
    filterIcon,
    condition: ['推荐职能岗']
  },
  {
    title: '操作时间',
    dataIndex: 'labelUpdateTime',
    key: 'operatorTime',
    formType: 'time',
    field: 'pr.labelUpdateTime',
    timeParams: ['labelStartTime', 'labelEndTime'],
    customFilterDropdown: true,
    filterIcon,
    condition: ['推荐职能岗']
  },
  {
    title: '所属大区',
    dataIndex: 'region',
    key: 'region',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    width: 100,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '投递时间',
    dataIndex: 'deliverTime',
    key: 'deliverTime',
    formType: 'time',
    customFilterDropdown: true,
    field: 'es.create_time',
    timeParams: ['deliverBeginTime', 'deliverEndTime'],
    filterIcon,
    condition: ['待分配', '待约面', '我的团队', '维护中', '筛选历史', '维护历史', '推荐职能岗']
  },

  {
    title: '简历来源',
    dataIndex: 'source',
    key: 'source',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"]
  },
  {
    title: '内推人',
    dataIndex: 'recommendsName',
    key: 'isRecommends',
    formType: 'select',
    customFilterDropdown: true,
    filterIcon,
    condition: ['待分配', '待约面', '待面试', '待考核', '我的团队', '维护中', '筛选历史', '约面历史', '面试历史', '考核历史', '维护历史', '待入职', '实习中', '试用中', '已转正', '解约', '离职', '劝退', '推荐职能岗','待签应约',"待签三方","放弃"],
    options: [
      {
        label: '是', value: "0"
      },
      {
        label: '否', value: "1"
      }
    ]
  }
];

